import React, { Component } from 'react';
import { use_home_nav } from '../../utils/api';
class mycreatlist extends Component {
  state = {
    createlist: []
  }
  componentDidMount() {
    use_home_nav().then((res) => {
      this.setState({
        createlist: res.data.list
      })
    })
  }
  render() {
    return (
      <div className='createlist'>
        {
          this.state.createlist && this.state.createlist.length > 0
            ?
            this.state.createlist.map((item, index) => {
              return (
                <div className='cate' key={index}>
                  <img src={item.pic} alt="" />
                  <span>{item.name}</span>
                </div>
              )
            })
            :
            <div>
              加载中....
            </div>
        }
      </div>
    );
  }
}

export default mycreatlist;